package com.zenchn.dynamic;

import static com.zenchn.dynamic.TSysAccountRoleMapperDynamicSqlSupport.*;

import com.zenchn.model.TSysAccountRoleMapper;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;

@Mapper
public interface TSysAccountRoleMapperDynamicMapper {
    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    BasicColumn[] selectList = BasicColumn.columnList(roleId, accountId);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    int insert(InsertStatementProvider<TSysAccountRoleMapper> insertStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    @InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
    int insertMultiple(MultiRowInsertStatementProvider<TSysAccountRoleMapper> multipleInsertStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TSysAccountRoleMapperResult")
    Optional<TSysAccountRoleMapper> selectOne(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TSysAccountRoleMapperResult", value = {
        @Result(column="role_id", property="roleId", jdbcType=JdbcType.CHAR),
        @Result(column="account_id", property="accountId", jdbcType=JdbcType.CHAR)
    })
    List<TSysAccountRoleMapper> selectMany(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    default long count(CountDSLCompleter completer) {
        return MyBatis3Utils.countFrom(this::count, TSysAccountRoleMapper, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    default int delete(DeleteDSLCompleter completer) {
        return MyBatis3Utils.deleteFrom(this::delete, TSysAccountRoleMapper, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    default int insert(TSysAccountRoleMapper record) {
        return MyBatis3Utils.insert(this::insert, record, TSysAccountRoleMapper, c ->
            c.map(roleId).toProperty("roleId")
            .map(accountId).toProperty("accountId")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    default int insertMultiple(Collection<TSysAccountRoleMapper> records) {
        return MyBatis3Utils.insertMultiple(this::insertMultiple, records, TSysAccountRoleMapper, c ->
            c.map(roleId).toProperty("roleId")
            .map(accountId).toProperty("accountId")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    default int insertSelective(TSysAccountRoleMapper record) {
        return MyBatis3Utils.insert(this::insert, record, TSysAccountRoleMapper, c ->
            c.map(roleId).toPropertyWhenPresent("roleId", record::getRoleId)
            .map(accountId).toPropertyWhenPresent("accountId", record::getAccountId)
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    default Optional<TSysAccountRoleMapper> selectOne(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectOne(this::selectOne, selectList, TSysAccountRoleMapper, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    default List<TSysAccountRoleMapper> select(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectList(this::selectMany, selectList, TSysAccountRoleMapper, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    default List<TSysAccountRoleMapper> selectDistinct(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectDistinct(this::selectMany, selectList, TSysAccountRoleMapper, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    default int update(UpdateDSLCompleter completer) {
        return MyBatis3Utils.update(this::update, TSysAccountRoleMapper, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    static UpdateDSL<UpdateModel> updateAllColumns(TSysAccountRoleMapper record, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(roleId).equalTo(record::getRoleId)
                .set(accountId).equalTo(record::getAccountId);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_account_role_mapper")
    static UpdateDSL<UpdateModel> updateSelectiveColumns(TSysAccountRoleMapper record, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(roleId).equalToWhenPresent(record::getRoleId)
                .set(accountId).equalToWhenPresent(record::getAccountId);
    }
}